<template>
	<view class="wrap">
		
		<view class="banner">
			<image class="banner-img" :src="pageData.cover" mode=""></image>
		</view>
		
		<view class="hot-wrap">
			<view class="top">
				<view class="left">
					<view class="name">
						{{pageData.name}}
					</view>
					
				</view>
				<view class="riht" style="margin-bottom:20rpx" >
					<view class="price">
						{{pageData.price}}
					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="left">
					<view class="tuangou">
						{{pageData.balance}}
					</view>
				</view>
				<view class="riht btn"  >
					
					火热预定中
				</view>
			</view>
			
		</view>
		
		
		<view class="note-wrap">
			<view class="note-item" v-for="(item,index) in pageData.note" :key="index">
				{{item}}
			</view>
		</view>
		
		<view class="sub-wrap">
			<view class="left">
				
				<text>
					消耗：<text class="money">{{pageData.consume}}</text>
				</text>
			</view>
			
			<view class="right" @click="subData">
				预定
			</view>
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				data:{},
				amount:0,
				pageData:{
					note:[]
					
				}
			}
		},
		onLoad(options) {
			this.data=JSON.parse(options.data)
             this.geData()  
		},
		methods: {


			geData(){
				
				let that=this
				that.apipost('/api/groupbuy/reserve_detail',{
					id:that.data.id
				},true).then(res => {
					if(res.Code==10200){
						that.pageData=res.Data
						
						uni.setNavigationBarTitle({
							title:res.Data.name
						});
					}
					
				}).catch(err=>{
					console.log(err)
				});
			},
			subData(){
				let that=this
			
				
				uni.showModal({
					title: '提示',
					content: '确认预定？',
					success: function (res) {
						if (res.confirm) {
							  that.apipost('/api/groupbuy/submit_reserve',{
								 id:that.data.id
							  },true).then(res => {
							  	if(res.Code==10200){
							  		
							  		uni.showToast({
							  		    title: res.Message,
							  		    duration:4000,
							  			icon:'none'
							  		});
							  	}
							  
							  }).catch(err=>{
							  console.log(err)
							  });
								
								
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			    
				
				
				
				
				
			}
		}
	}
</script>

<style>
	.hot-wrap .btn{
		border-radius:14rpx;
		border:1rpx solid #ff2823;
		height:52rpx;
		width:172rpx;
		display:flex;
		align-items: center;
		justify-content:center;
	}
	.hot-wrap{
		font-size:30rpx;
		font-weight:bold;
		padding:18rpx  38rpx 34rpx 40rpx;
		box-sizing: border-box;
		margin:0 auto;
		width:656rpx;
		background:#fff;
		border-bottom-left-radius: 15rpx;
		border-bottom-right-radius: 15rpx;
	}
	.hot-wrap .top{
		font-size:40rpx;
		display:flex;
		align-items: center;
		justify-content: space-between;
	}

	.hot-wrap .top .riht{
		color:#f62721;
		position:relative;
		margin-top:30rpx;
		
	}
	.hot-wrap .top .left{
		display:flex;
		align-items: center;
		
		height:80rpx;
		
		background-size:40rpx auto;
	}
	//hotbg
	
	.hot-wrap .bottom{
		font-weight:normal;
		display:flex;
		align-items: center;
		justify-content: space-between;
		padding-top:30rpx;
	}
	.sub-wrap .left .money{
		color:#fe0600;
		
		align-items: center;
	}
	.sub-wrap .left{
		border-top-left-radius: 20rpx;
		border-bottom-left-radius: 20rpx;
		padding-left:40rpx;
		flex:1;
		height:94rpx;
		background:#fff;
		display:flex;
		
		align-items: center;
	}
	.sub-wrap .right{
		border-top-right-radius: 20rpx;
		border-bottom-right-radius: 20rpx;
		color:#fff;
		width:214rpx;
		height:94rpx;
		background:#ff2823;
		display:flex;
		justify-content: center;
		align-items: center;
	}
	.sub-wrap{
		border-radius:8rpx;
		display:flex;
		justify-content: space-between;
		font-size:32rpx;
		width:656rpx;
		margin:0 auto;
		margin-top:70rpx;
	}
	.note-wrap{
		width:656rpx;
		margin:0 auto;
		padding-top:250rpx;
	}
	.num-wrap .item-list .content .jia{
		margin-left:10rpx;
		height:30rpx;
		width:30rpx;
		display: flex;
		justify-content: center;
		border:1rpx solid #000;
		align-items: center;
		font-size:40rpx;
	}
	.num-wrap .item-list .content .jian{
		margin-left:20rpx;
		font-size:40rpx;
		height:32rpx;
		width:32rpx;
		display: flex;
		justify-content: center;
		border:1rpx solid #000;
		align-items: center;
	}
	
	.num-wrap .item-list .content{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.num-wrap .item-list{
		display: flex;
		
		border-bottom:1rpx solid #ededed;
		justify-content: space-between;
		height:114rpx;
		align-items: center;
	}
	.num-wrap{
		border-radius:10rpx;
		width:656rpx;
		margin:0 auto;
		padding:0 40rpx;
		box-sizing: border-box;
		background:#fff;
		margin-top:48rpx;
	}
	.title{
		height:90rpx;
		display:flex;
		justify-content: center;
		align-items: center;
		
	}
	page{
		background:#eee;
	}
	.wrap{
		background:#eee;
		
	}
	
	.banner{
		margin:0 auto;
		width:656rpx;
		height:360rpx;
		margin-top:20rpx;
	}
	
	.banner-img{
		border-top-left-radius: 15rpx;
		border-top-right-radius: 15rpx;
	}
</style>
